# @title Draw the generated maps in top-down view with fixed block sequence
# @markdown You can also specify the road block sequence then randomize the block parameters.
# @markdown Please refer to [documentation](https://metadrive-simulator.readthedocs.io/en/latest/env_config.html#map-config) for the meaning of the map string.

import random
import matplotlib.pyplot as plt
from metadrive.utils.draw_top_down_map import draw_top_down_map
from metadrive import MetaDriveEnv

env = MetaDriveEnv(config=dict(
    num_scenarios=100,
    map="CrTRXOS",
    start_seed=random.randint(0, 1000)
))

fig, axes = plt.subplots(4, 4, figsize=(10, 10), dpi=100)
for i in range(4):
    for j in range(4):
        env.reset() # 重置环境， 生成新的随机地图
        m = draw_top_down_map(env.current_map)  # 绘制当前地图的俯视图
        ax = axes[i][j]
        ax.imshow(m, cmap="bone")
        ax.set_xticks([])
        ax.set_yticks([])
fig.suptitle("Bird-eye view of generated maps.")
plt.show()

env.close()
